<template>
	<view class="">
		<view class="people">
			<view class="people_information" v-for="(item, index) in userinfo" :key="index">
				<view class="people_information_p">
					<view v-if="userinfo.length == 1" class="title"><text>报名信息</text></view>
					<view v-else class="title">
						<text>报名人{{ index + 1 }}</text>
					</view>
					<view class="time">{{ item.create_time_m }}</view>
				</view>
				<view class="info">
					<view class="item user" v-for="(items, key) in item.form" v-if="items.value">
						<view class="info_info_l info_info">{{ items.name }}：</view>
						<view class="info_info_r info_info" v-if="items.type != 'image'">{{ items.value }}</view>
						<image v-else :src="items.value" mode="" @tap="preview(items.value)"></image>
					</view>
				</view>
			</view>
		</view>
		<navigation></navigation>
	</view>
</template>

<script>
import navigation from '@/components/navigation/navigation.vue';
export default {
	components: {
		navigation
	},
	data() {
		return {
			list: [
				{ user: '王磊', mobile: '123312414', sex: '男', age: '23' },
				{ user: '磊', mobile: '123312414', sex: '男', age: '23' },
				{ user: 'fs', mobile: '123312414', sex: '女', age: '23' }
			],
			order_id: '',
			userinfo: []
		};
	},
	mounted() {
		this.getuserInfo();
	},
	onLoad(options) {
		this.order_id = options.id;
	},
	methods: {
		getuserInfo() {
			this.ajax('order/orderUser', {
				data: {
					order_id: this.order_id
				},
				success: res => {
					 // console.log (res);
					res.msg.forEach(item => {
						item.create_time_m = item.create_time.slice(0, 10);
					});
					// if(res.msg.length>1) {
					// uni.setNavigationBarTitle({
					//     title: '组队电子票'
					// });
					// }
					this.userinfo = res.msg;
				}
			});
		},
		preview (url) {
			      uni.previewImage({
			            urls: url,
			            longPressActions: {
			                itemList: ['发送给朋友', '保存图片', '收藏'],
			                success: function(data) {
			                     // console.log ('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
			                },
			                fail: function(err) {
			                     // console.log (err.errMsg);
			                }
			            }
			        });
		}
	}
};
</script>

<style lang="less" scoped>
.people {
	width: 100%;
	background-color: #ffffff;
	box-sizing: border-box;
	.people_information {
		.info {
			width: 100%;
			padding: 0 30upx;
			box-sizing: border-box;
			padding-top: 30upx;
			.item {
				width: 100%;
				display: flex;
				align-items: center;
				margin-bottom: 30upx;
			}
			.info_info {
				font-size: 28upx;
				color: #333333;
			}
			.info_info_r {
				width: 480upx;
			}
			image {
				width: 160upx;
				height: 160upx;
			}
			.info_info_l {
				width: 200upx;
			}
		}
		.title {
			height: 66upx;
			background-color: #f2f2f2;
			font-size: 28upx;
			line-height: 66upx;
			font-weight: bold;
			color: #333;
		}
		.people_information_p {
			display: flex;
			justify-content: space-between;
			align-items: center;
			height: 66upx;
			background-color: #f2f2f2;
			padding: 0 30upx;
			box-sizing: border-box;
			.time {
				font-size: 28upx;
				color: #999999;
			}
		}
	}
}
</style>
<style>
page {
	background-color: #ffffff;
}
</style>
